home *** CD-ROM | disk | FTP | other *** search
- Path: pegasus.montclair.edu!harmon
- From: harmon@pegasus.montclair.edu (Derek Harmon)
- Newsgroups: comp.lang.c
- Subject: Re: simple code, argc, argv, strcmp()
- Date: 13 Feb 1996 16:01:01 -0500
- Organization: Montclair State University
- Message-ID: <harmon.824243856@pegasus.montclair.edu>
- References: <11f7cc$17261a.3b3@daprez> <harmon.823197381@pegasus.montclair.edu> <9602100309.AA15971@dxmint.cern.ch>
- NNTP-Posting-Host: pegasus.montclair.edu
- X-Newsreader: NN version 6.5.0 #68 (NOV)
-
- Dan Pop <danpop@mail.cern.ch> writes:
-
- >harmon@pegasus.montclair.edu (Derek Harmon) writes:
- >> Therefore, I would suggest that you only call Usage() when argv[1] is
- >>not "-d" AND not "-e":
- >>
- >>: if (!strcmp(argv[1],"-d") && !strcmp(argv[1],"-e")) {
-
- >Yet another guy who got it wrong :-) This will evaluate to 1 only when
- >argv[1] is "-d" AND "-e", i.e. NEVER.
-
- Aye.. drop the exclamation points and batton down the hatches. :) It
- worked in plain English, though. :)
-
- >!strcmp() is EVIL and this thread demonstrated it a zillion times.
- >Don't use it if you want to preserve your sanity :-)
-
- Though I have reams of parser code that relies heavily upon it already,
- perhaps we can all put this is an include file somewhere,
-
- : #define STREQUAL(s1,s2) (!strcmp((s1),(s2)))
-
- and then those of use who don't think it can be rehabilitated can delete
- it. :)
- -- Stone
- --
- # Derek Harmon (aka Stonelight) harmon@pegasus.montclair.edu
- # - Computer Science Undergrad, Montclair State University, NJ
- # - My views are my own, nobody else is this creative. 3;)>
- ... A bird in the hand makes it hard to blow your nose.
-